%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/conditions/archived-forum-inherited-messages.stream-3"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 6, 9, 10, 29, 30, 52, 53, 54, 11, 13, 28, 32<br />2: PgSelect[8]<br />3: PgSelectRows[14]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 11, 28, 32, 29, 30, 6<br /><br />ROOT __Item{1}ᐸ14ᐳ[15]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 16, 11, 28, 32, 29, 30, 6<br /><br />ROOT PgSelectSingle{1}ᐸforumsᐳ[16]<br />1: <br />ᐳ: 17, 19, 25<br />2: PgSelect[20]<br />3: Connection[24]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 24, 29, 30, 6, 11<br /><br />ROOT Connection{2}ᐸ20ᐳ[24]"):::bucket
    Bucket5("Bucket 5 (listItem)<br />Deps: 11<br /><br />ROOT __Item{5}ᐸ33ᐳ[37]"):::bucket
    Bucket6("Bucket 6 (nullableBoundary)<br />Deps: 38, 11<br /><br />ROOT PgSelectSingle{5}ᐸmessagesᐳ[38]<br />1: <br />ᐳ: 39, 40<br />2: PgSelect[41]<br />3: PgSelectRows[46]<br />ᐳ: First[45], PgSelectSingle[47]"):::bucket
    Bucket7("Bucket 7 (nullableBoundary)<br />Deps: 47<br /><br />ROOT PgSelectSingle{6}ᐸusersᐳ[47]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3
    Bucket3 --> Bucket5
    Bucket5 --> Bucket6
    Bucket6 --> Bucket7

    %% plan dependencies
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸforumsᐳ<br />More deps:<br />- Object[11]"]]:::plan
    Lambda13{{"Lambda[13∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'EXCLUSIVELY' ]ᐳ[53]"}}:::plan
    Lambda13 --> PgSelect8
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ<br />Dependents: 3"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
    PgSelect8 --> PgSelectRows14
    Lambda28{{"Lambda[28∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[54]"}}:::plan
    Lambda32{{"Lambda[32∈0] ➊<br />ᐸresolveStreamDetailsᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[52]"}}:::plan
    __Item15[/"__Item[15∈1]<br />ᐸ14ᐳ"\]:::itemplan
    PgSelectRows14 ==> __Item15
    PgSelectSingle16{{"PgSelectSingle[16∈1]<br />ᐸforumsᐳ"}}:::plan
    __Item15 --> PgSelectSingle16
    PgSelect20[["PgSelect[20∈2]<br />ᐸmessagesᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression19{{"PgClassExpression[19∈2]<br />ᐸ__forums__.”id”ᐳ"}}:::plan
    PgClassExpression25{{"PgClassExpression[25∈2]<br />ᐸ__forums__...chived_at”ᐳ"}}:::plan
    PgClassExpression19 & PgClassExpression25 & Lambda28 & Lambda32 --> PgSelect20
    PgClassExpression17{{"PgClassExpression[17∈2]<br />ᐸ__forums__.”name”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression17
    PgSelectSingle16 --> PgClassExpression19
    Connection24[["Connection[24∈2]<br />ᐸ20ᐳ"]]:::plan
    PgSelect20 --> Connection24
    PgSelectSingle16 --> PgClassExpression25
    ConnectionItems33[["ConnectionItems[33∈3@s]"]]:::plan
    Connection24 --> ConnectionItems33
    __Item37[/"__Item[37∈5]<br />ᐸ33ᐳ"\]:::itemplan
    ConnectionItems33 ==> __Item37
    PgSelectSingle38{{"PgSelectSingle[38∈5]<br />ᐸmessagesᐳ"}}:::plan
    __Item37 --> PgSelectSingle38
    PgSelect41[["PgSelect[41∈6]<br />ᐸusersᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression40{{"PgClassExpression[40∈6]<br />ᐸ__messages...author_id”ᐳ"}}:::plan
    PgClassExpression40 --> PgSelect41
    PgClassExpression39{{"PgClassExpression[39∈6]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgSelectSingle38 --> PgClassExpression39
    PgSelectSingle38 --> PgClassExpression40
    First45{{"First[45∈6]"}}:::plan
    PgSelectRows46[["PgSelectRows[46∈6]"]]:::plan
    PgSelectRows46 --> First45
    PgSelect41 --> PgSelectRows46
    PgSelectSingle47{{"PgSelectSingle[47∈6]<br />ᐸusersᐳ"}}:::plan
    First45 --> PgSelectSingle47
    PgClassExpression48{{"PgClassExpression[48∈7]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle47 --> PgClassExpression48
    PgClassExpression49{{"PgClassExpression[49∈7]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression48 o--o PgClassExpression49

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Lambda13,PgSelectRows14,Lambda28,Lambda32 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item15,PgSelectSingle16 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression17,PgClassExpression19,PgSelect20,Connection24,PgClassExpression25 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,ConnectionItems33 bucket3
    classDef bucket5 stroke:#7fff00
    class Bucket5,__Item37,PgSelectSingle38 bucket5
    classDef bucket6 stroke:#ff1493
    class Bucket6,PgClassExpression39,PgClassExpression40,PgSelect41,First45,PgSelectRows46,PgSelectSingle47 bucket6
    classDef bucket7 stroke:#808000
    class Bucket7,PgClassExpression48,PgClassExpression49 bucket7

